package com.wmh.baseservice.operationaid.pojo.vo.FeatureParamTemplate;

import com.wmh.baseservice.operationaid.entity.FeatureParamTemplate;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author 谢骏
 * @date 2023/7/3 17:10
 **/
@Data
@ApiModel(value = "表格信息响应")
@Accessors(chain = true)
public class TableRepsVO {

    @ApiModelProperty(value = "主键")
    private Long id;

    @ApiModelProperty(value = "模板名称")
    private String name;

    @ApiModelProperty(value = "模板参数")
    private String params;


    @ApiModelProperty(value = "创建时间")
    private LocalDateTime createTime;

    @ApiModelProperty(value = "更新时间")
    private LocalDateTime updateTime;

    public static TableRepsVO build(FeatureParamTemplate t) {
        TableRepsVO tableRepsVO = new TableRepsVO();
        tableRepsVO.setId(t.getId());
        tableRepsVO.setName(t.getName());
        tableRepsVO.setParams(t.getParams());
        tableRepsVO.setCreateTime(t.getCreateTime());
        tableRepsVO.setUpdateTime(t.getUpdateTime());
        return tableRepsVO;
    }

    public static List<TableRepsVO> build(List<FeatureParamTemplate> list){
        return list.stream().map(TableRepsVO::build).collect(Collectors.toList());
    }
}
